home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / 4dtnt.zip / DO.DOC < prev    next >
Text File  |  1991-11-03  |  7KB  |  216 lines

  1.  
  2.    The key to this batch file is the labels.  For example, there is a label
  3.    "homemo".  There is an alias "homemo" which equals "do homemo".  The first
  4.    thing DO.BTM does is branch to the label defined in its first argument.
  5.    Thus, typing "homemo" on the command line expands to "do homemo" which
  6.    causes this batch file to branch to the "homemo" label.
  7.  
  8.    Having all the little batch files concentrated like this simplifies
  9.    maintenance, saves disk space (waste part of one cluster instead of many),
  10.    and allows the use of common subroutines.  However, you won't find any
  11.    common subroutines in this one because it evolved from a bunch of little
  12.    batch files which were simply copied together.
  13.  
  14. @ECHO off 
  15. if k%1 == k quit
  16. goto %1
  17. quit
  18. :buscor
  19.  
  20.    Here's the trick from NOLTR.ZIP to find out where my business
  21.    correspondence is kept.  "TO" is an alias for "pushd".  "FR" is an
  22.    alias for "popd".  "rsav nn" is an alias to change UltraVision text
  23.    modes and remember the existing mode.  "rset" is an alias to restore
  24.    the saved UltraVision mode when done.
  25.  
  26. to business
  27. set dr=%@substr[%_cwd,0,2]
  28. fr
  29. rsav 94
  30.  
  31.    If the letter I'm working on doesn't exist, stack a key macro to put
  32.    in the return address and date at the top of the page; otherwise
  33.    stack a key macro to go to the present end of text (where I'm likely
  34.    to want to continue typing).
  35.  
  36. ks 0 17 "c"
  37. if not exist %dr%\business\%2 ks 0 27 "b"
  38. ws %dr%\business\%2
  39. rset
  40. cls
  41. unset dr
  42.  
  43.    Bail out of the entire batch file when done editing the letter.
  44. quit
  45.  
  46.  
  47. :homemo
  48.  
  49.    This is similar to "buscor" above, but the date is used to make
  50.    a file name.  This is the name the home office mainframe expects
  51.    to see when I send the memo,
  52.  
  53. set memoname=%@substr[%_date,0,2]%@substr[%_date,3,2]%@substr[%_date,6,2]
  54. iff exist %ramd%%memoname% then
  55.   ks 0 27 "a" 17 "c"
  56.     else
  57.   ks 0 27 "a" 27 "@"
  58. endiff
  59. rsav 94
  60. ws %ramd%%memoname%
  61. rset
  62. cls
  63. unset memoname
  64. quit
  65.  
  66.  
  67.    The following series of "pack" functions takes text files sent from
  68.    the mainframe to directory "hobuff", squashes out excess junk and
  69.    reformats them as necessary for editing later on my PC.  The result
  70.    goes to directory "vsource".  Again, drive letter independence is
  71.    maintained.  
  72.  
  73.    It makes a difference whether the source language was basic, cobol, c, 
  74.    assembler, or procedure (the frame's batch language).  The incoming
  75.    text format is different and the file extension is set to indicate
  76.    the language.
  77.  
  78. :packbas
  79. :packcob
  80. if .%2 == . quit
  81.  
  82.    Find "vsource" without resorting to drive letter.
  83.  
  84. to vsource
  85. set dr=%@substr[%_cwd,0,2]
  86. fr
  87.  
  88.    Find "hobuff" without resorting to drive letter.
  89.  
  90. to hobuff
  91. set drh=%@substr[%_cwd,0,2]
  92. fr
  93. set fname=%@name[%2]
  94. if not exist %drh%\hobuff\%fname%.asc quit
  95.  
  96.    Pick up the last three letters of the command as the new file extension.
  97. erase %dr%\vsource\%fname%.%@substr[%1,4,3]
  98.  
  99.    Call a homebrew text munger to do the reformatting.
  100. leftn 6 %drh%\hobuff\%fname%.asc %dr%\vsource\%fname%.%@substr[%1,4] 
  101. goto packup
  102. :packasm
  103. :packpro
  104. :packc
  105. to vsource
  106. set dr=%@substr[%_cwd,0,2]
  107. fr
  108. to hobuff
  109. set drh=%@substr[%_cwd,0,2]
  110. fr
  111. if .%2 == . quit
  112. set fname=%@name[%2]
  113. if not exist %drh%\hobuff\%fname%.asc quit
  114. erase %dr%\vsource\%fname%.%@substr[%1,4,3]
  115.    A different homebrew munger for these languages.
  116. squoze 72 %drh%\hobuff\%fname%.asc %dr%\vsource\%fname%.%@substr[%1,4] 
  117. :packup
  118.  
  119.    Make sure the reformatting process made a new file before erasing
  120.    the old one.
  121.  
  122. if not exist %dr%\vsource\%fname%.%@substr[%1,4] quit
  123. if not %@filesize[%dr%\vsource\%fname%.%@substr[%1,4,3],B] gt 0 quit
  124. erase %drh%\hobuff\%fname%.asc
  125. unset fname
  126. quit
  127.  
  128.  
  129.    The following finds source files by name regardless of extension, in
  130.    directory vsource, regardless of drive letter and sets up the editing
  131.    operation.  
  132.    The source file is copied to ramdisk for editing.
  133.    The edited result has the WordStar formatting stripped off by a filter
  134.    (filter9) and put back in the source directory.
  135.    The edited result is stripped and reformatted correctly for transmission
  136.    back to the mainframe and put in directory "hobuff".
  137.    The ramdisk copy is then erased.
  138.  
  139.    A different keystroke macro is set up for each different source
  140.    language's tab and margin settings.
  141.   
  142. :vsedit
  143.    Find the source code on any drive.
  144. to vsource
  145. set dr=%@substr[%_cwd,0,2]
  146. fr
  147.    Get a drive letter for hobuff.
  148. to hobuff
  149. set drh=%@substr[%_cwd,0,2]
  150. fr
  151.  
  152. if .%2 == . quit
  153. unset ext >& nul
  154.  
  155.    Validate the extension. If there is no such file under any of the 
  156.    expected extensions, prompt the user for the extension under which
  157.    to create a new source file.
  158.  
  159.    This section also sets up the correct tab setting key macro in 
  160.    variable "tabch".
  161.  
  162.    Standardize case for insensitivity to same.
  163. set ext=%@lower[%@ext[%2]]
  164. set fname=%@name[%2]
  165. if .%ext% ne . goto chkext
  166. if not exist %dr%\vsource\%fname%.* goto chkext
  167. set tabch="c"
  168. set ext=bas
  169. if exist %dr%\vsource\%fname%.bas goto doedit
  170. set ext=cob
  171. if exist %dr%\vsource\%fname%.cob goto doedit
  172. set tabch="a"
  173. set ext=asm
  174. if exist %dr%\vsource\%fname%.asm goto doedit
  175. set ext=pro
  176. if exist %dr%\vsource\%fname%.pro goto doedit
  177. set ext=c
  178. if exist %dr%\vsource\%fname%.c   goto doedit
  179. unset ext
  180. :chkext
  181. set tabch="a"
  182. if .%ext% == .asm .or. .%ext% == .pro .or. .%ext% == .c goto doedit
  183. set tabch="c"
  184. if .%ext% == .cob .or. .%ext% == .bas goto doedit
  185. input Enter extension BAS, ASM, PRO, COB, or C %%ext
  186. if .%ext% ne . set ext=%@lower[%ext%]
  187. goto chkext
  188.  
  189. :doedit
  190. if exist %dr%\vsource\%fname%.%ext% copy %dr%\vsource\%fname%.%ext% %ramd%
  191.   
  192.   For any language except procedure or C, lock upper case.
  193. if .%ext% ne .pro .and. .%ext% ne .c toggle C >& NUL
  194. rsav 60
  195.  
  196.   Keystack the right macro and run Wordstar.
  197. ks 0 27 %tabch%
  198. ws %ramd%%fname%.%ext%
  199.  
  200.   Quit if the copy or edit operation destroyed the file.
  201. if not exist %ramd%%fname%.%ext% quit
  202.  
  203.   Strip out WS formatting for PC permanent copy.
  204. filter9 < %ramd%%fname%.%ext% > %dr%\vsource\%fname%.%ext%
  205.  
  206.   Put the latest and greatest in "hobuff" for the mainframe.
  207. erase %drh%\hobuff\%fname >& NUL
  208. if %tabch% == "c" rightn 6 %dr%\vsource\%fname%.%ext% %drh%\hobuff\%fname
  209. if %tabch% == "a" filter9 < %ramd%%fname%.%ext% > %drh%\hobuff\%fname%
  210. erase %ramd%%fname%.%ext% >& NUL
  211. unset fname ext tabch dr drh
  212. rset 
  213. toggle c >& NUL
  214. cls
  215. quit
  216.